/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.teamreinforce.ejb.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author tidiane
 */
@Entity
@Table(name = "projet")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Projet.findAll", query = "SELECT p FROM Projet p"),
    @NamedQuery(name = "Projet.findByIdProjet", query = "SELECT p FROM Projet p WHERE p.idProjet = :idProjet"),
    @NamedQuery(name = "Projet.findByTitre", query = "SELECT p FROM Projet p WHERE p.titre = :titre"),
    @NamedQuery(name = "Projet.findByDateDebut", query = "SELECT p FROM Projet p WHERE p.dateDebut = :dateDebut"),
    @NamedQuery(name = "Projet.findByDateFin", query = "SELECT p FROM Projet p WHERE p.dateFin = :dateFin"),
    @NamedQuery(name = "Projet.findByDuree", query = "SELECT p FROM Projet p WHERE p.duree = :duree")})
public class Projet implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_projet")
    private Integer idProjet;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "titre")
    private String titre;
    @Lob
    @Size(max = 65535)
    @Column(name = "description")
    private String description;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "date_debut")
    private String dateDebut;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "date_fin")
    private String dateFin;
    @Column(name = "duree")
    private Integer duree;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "projet", fetch= FetchType.EAGER)
    private List<Etape> etapeList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "projet", fetch= FetchType.EAGER)
    private List<Sujet> sujetList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "projet", fetch= FetchType.EAGER)
    private List<Role> roleList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "projet", fetch= FetchType.EAGER)
    private List<Risque> risqueList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "projet", fetch= FetchType.EAGER)
    private List<Reunion> reunionList;

    public Projet() {
    }

    public Projet(Integer idProjet) {
        this.idProjet = idProjet;
    }

    public Projet(Integer idProjet, String titre, String dateDebut, String dateFin) {
        this.idProjet = idProjet;
        this.titre = titre;
        this.dateDebut = dateDebut;
        this.dateFin = dateFin;
    }

    public Integer getIdProjet() {
        return idProjet;
    }

    public void setIdProjet(Integer idProjet) {
        this.idProjet = idProjet;
    }

    public String getTitre() {
        return titre;
    }

    public void setTitre(String titre) {
        this.titre = titre;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getDateDebut() {
        return dateDebut;
    }

    public void setDateDebut(String dateDebut) {
        this.dateDebut = dateDebut;
    }

    public String getDateFin() {
        return dateFin;
    }

    public void setDateFin(String dateFin) {
        this.dateFin = dateFin;
    }

    public Integer getDuree() {
        return duree;
    }

    public void setDuree(Integer duree) {
        this.duree = duree;
    }

    
    public List<Etape> getEtapeList() {
        return etapeList;
    }

    public void setEtapeList(List<Etape> etapeList) {
        this.etapeList = etapeList;
    }

    @XmlTransient
    public List<Sujet> getSujetList() {
        return sujetList;
    }

    public void setSujetList(List<Sujet> sujetList) {
        this.sujetList = sujetList;
    }

    @XmlTransient
    public List<Role> getRoleList() {
        return roleList;
    }

    public void setRoleList(List<Role> roleList) {
        this.roleList = roleList;
    }

    
    public List<Risque> getRisqueList() {
        return risqueList;
    }

    public void setRisqueList(List<Risque> risqueList) {
        this.risqueList = risqueList;
    }

    @XmlTransient
    public List<Reunion> getReunionList() {
        return reunionList;
    }

    public void setReunionList(List<Reunion> reunionList) {
        this.reunionList = reunionList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idProjet != null ? idProjet.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Projet)) {
            return false;
        }
        Projet other = (Projet) object;
        if ((this.idProjet == null && other.idProjet != null) || (this.idProjet != null && !this.idProjet.equals(other.idProjet))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.teamreinforce.ejb.entities.Projet[ idProjet=" + idProjet + " ]";
    }
    
}
